
<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>pymatgen.analysis.cost &#8212; pymatgen 2020.7.3 documentation</title>
    <link rel="stylesheet" href="../../../_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
    <script src="../../../_static/jquery.js"></script>
    <script src="../../../_static/underscore.js"></script>
    <script src="../../../_static/doctools.js"></script>
    <script src="../../../_static/language_data.js"></script>
    <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" />
 
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-33990148-1']);
  _gaq.push(['_trackPageview']);
</script>

  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../index.html">pymatgen 2020.7.3 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../../pymatgen.html" accesskey="U">pymatgen</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">pymatgen.analysis.cost</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
          <div class="body" role="main">
            
  <h1>Source code for pymatgen.analysis.cost</h1><div class="highlight"><pre>
<span></span><span class="c1"># coding: utf-8</span>
<span class="c1"># Copyright (c) Pymatgen Development Team.</span>
<span class="c1"># Distributed under the terms of the MIT License.</span>

<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">This module is used to estimate the cost of various compounds. Costs are taken</span>
<span class="sd">from the a CostDB instance, for example a CSV file via CostDBCSV.</span>
<span class="sd">For compounds with no cost listed, a Phase Diagram style convex hull</span>
<span class="sd">optimization is performed to determine a set of compositions that can be mixed</span>
<span class="sd">to give the desired compound with lowest total cost.</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">abc</span>
<span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">defaultdict</span>
<span class="kn">import</span> <span class="nn">csv</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">itertools</span>
<span class="kn">from</span> <span class="nn">monty.design_patterns</span> <span class="kn">import</span> <span class="n">singleton</span>
<span class="kn">from</span> <span class="nn">monty.string</span> <span class="kn">import</span> <span class="n">unicode2str</span>

<span class="kn">import</span> <span class="nn">scipy.constants</span> <span class="k">as</span> <span class="nn">const</span>

<span class="kn">from</span> <span class="nn">pymatgen</span> <span class="kn">import</span> <span class="n">Composition</span><span class="p">,</span> <span class="n">Element</span>
<span class="kn">from</span> <span class="nn">pymatgen.util.provenance</span> <span class="kn">import</span> <span class="n">is_valid_bibtex</span>
<span class="kn">from</span> <span class="nn">pymatgen.analysis.phase_diagram</span> <span class="kn">import</span> <span class="n">PDEntry</span><span class="p">,</span> <span class="n">PhaseDiagram</span>
<span class="kn">from</span> <span class="nn">io</span> <span class="kn">import</span> <span class="nb">open</span>

<span class="n">__author__</span> <span class="o">=</span> <span class="s1">&#39;Anubhav Jain&#39;</span>
<span class="n">__copyright__</span> <span class="o">=</span> <span class="s1">&#39;Copyright 2013, The Materials Project&#39;</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s1">&#39;0.1&#39;</span>
<span class="n">__maintainer__</span> <span class="o">=</span> <span class="s1">&#39;Anubhav Jain&#39;</span>
<span class="n">__email__</span> <span class="o">=</span> <span class="s1">&#39;ajain@lbl.gov&#39;</span>
<span class="n">__date__</span> <span class="o">=</span> <span class="s1">&#39;Aug 27, 2013&#39;</span>

<span class="n">module_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="vm">__file__</span><span class="p">))</span>


<div class="viewcode-block" id="CostEntry"><a class="viewcode-back" href="../../../pymatgen.analysis.cost.html#pymatgen.analysis.cost.CostEntry">[docs]</a><span class="k">class</span> <span class="nc">CostEntry</span><span class="p">(</span><span class="n">PDEntry</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Extends PDEntry to include a BibTeX reference and include language about</span>
<span class="sd">    cost</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">composition</span><span class="p">,</span> <span class="n">cost</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">reference</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Args:</span>
<span class="sd">            composition:</span>
<span class="sd">                Composition as a pymatgen.core.structure.Composition</span>
<span class="sd">            cost:</span>
<span class="sd">                Cost (per mol, NOT per kg) of the full Composition</span>
<span class="sd">            name:</span>
<span class="sd">                Optional parameter to name the entry. Defaults to the reduced</span>
<span class="sd">                chemical formula as in PDEntry.</span>
<span class="sd">            reference:</span>
<span class="sd">                Reference data as BiBTeX string</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">composition</span><span class="p">,</span> <span class="n">cost</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">reference</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">is_valid_bibtex</span><span class="p">(</span><span class="n">reference</span><span class="p">):</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
                <span class="s2">&quot;Invalid format for cost reference! Should be BibTeX string.&quot;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">reference</span> <span class="o">=</span> <span class="n">reference</span>

    <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s2">&quot;CostEntry : </span><span class="si">{}</span><span class="s2"> with cost = </span><span class="si">{:.4f}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">composition</span><span class="p">,</span>
                                                          <span class="bp">self</span><span class="o">.</span><span class="n">energy</span><span class="p">)</span></div>


<div class="viewcode-block" id="CostDB"><a class="viewcode-back" href="../../../pymatgen.analysis.cost.html#pymatgen.analysis.cost.CostDB">[docs]</a><span class="k">class</span> <span class="nc">CostDB</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">abc</span><span class="o">.</span><span class="n">ABCMeta</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Abstract class for representing a Cost database.</span>
<span class="sd">    Can be extended, e.g. for file-based or REST-based databases</span>
<span class="sd">    &quot;&quot;&quot;</span>

<div class="viewcode-block" id="CostDB.get_entries"><a class="viewcode-back" href="../../../pymatgen.analysis.cost.html#pymatgen.analysis.cost.CostDB.get_entries">[docs]</a>    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">get_entries</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">chemsys</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        For a given chemical system, return an array of CostEntries</span>

<span class="sd">        Args:</span>
<span class="sd">            chemsys:</span>
<span class="sd">                array of Elements defining the chemical system.</span>

<span class="sd">        Returns:</span>
<span class="sd">            array of CostEntries</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span></div></div>


<div class="viewcode-block" id="CostDBCSV"><a class="viewcode-back" href="../../../pymatgen.analysis.cost.html#pymatgen.analysis.cost.CostDBCSV">[docs]</a><span class="k">class</span> <span class="nc">CostDBCSV</span><span class="p">(</span><span class="n">CostDB</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Read a CSV file to get costs</span>
<span class="sd">    Format is formula,cost_per_kg,name,BibTeX</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Args:</span>
<span class="sd">            filename (str): Filename of cost database.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="c1"># read in data from file</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_chemsys_entries</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span>
        <span class="n">filename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="vm">__file__</span><span class="p">),</span> <span class="n">filename</span><span class="p">)</span>
        <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s2">&quot;rt&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
            <span class="n">reader</span> <span class="o">=</span> <span class="n">csv</span><span class="o">.</span><span class="n">reader</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">quotechar</span><span class="o">=</span><span class="n">unicode2str</span><span class="p">(</span><span class="s2">&quot;|&quot;</span><span class="p">))</span>
            <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">reader</span><span class="p">:</span>
                <span class="n">comp</span> <span class="o">=</span> <span class="n">Composition</span><span class="p">(</span><span class="n">row</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
                <span class="n">cost_per_mol</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">row</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="o">*</span> <span class="n">comp</span><span class="o">.</span><span class="n">weight</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="s2">&quot;kg&quot;</span><span class="p">)</span> <span class="o">*</span> <span class="n">const</span><span class="o">.</span><span class="n">N_A</span>
                <span class="n">pde</span> <span class="o">=</span> <span class="n">CostEntry</span><span class="p">(</span><span class="n">comp</span><span class="o">.</span><span class="n">formula</span><span class="p">,</span> <span class="n">cost_per_mol</span><span class="p">,</span> <span class="n">row</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">row</span><span class="p">[</span><span class="mi">3</span><span class="p">])</span>
                <span class="n">chemsys</span> <span class="o">=</span> <span class="s2">&quot;-&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">sorted</span><span class="p">([</span><span class="n">el</span><span class="o">.</span><span class="n">symbol</span>
                                           <span class="k">for</span> <span class="n">el</span> <span class="ow">in</span> <span class="n">pde</span><span class="o">.</span><span class="n">composition</span><span class="o">.</span><span class="n">elements</span><span class="p">]))</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_chemsys_entries</span><span class="p">[</span><span class="n">chemsys</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">pde</span><span class="p">)</span>

<div class="viewcode-block" id="CostDBCSV.get_entries"><a class="viewcode-back" href="../../../pymatgen.analysis.cost.html#pymatgen.analysis.cost.CostDBCSV.get_entries">[docs]</a>    <span class="k">def</span> <span class="nf">get_entries</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">chemsys</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        For a given chemical system, return an array of CostEntries</span>

<span class="sd">        Args:</span>
<span class="sd">            chemsys:</span>
<span class="sd">                array of Elements defining the chemical system.</span>

<span class="sd">        Returns:</span>
<span class="sd">            array of CostEntries</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">chemsys</span> <span class="o">=</span> <span class="s2">&quot;-&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">sorted</span><span class="p">([</span><span class="n">el</span><span class="o">.</span><span class="n">symbol</span> <span class="k">for</span> <span class="n">el</span> <span class="ow">in</span> <span class="n">chemsys</span><span class="p">]))</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_chemsys_entries</span><span class="p">[</span><span class="n">chemsys</span><span class="p">]</span></div></div>


<span class="nd">@singleton</span>
<span class="k">class</span> <span class="nc">CostDBElements</span><span class="p">(</span><span class="n">CostDBCSV</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Singleton object that provides the cost data for elements</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Init</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">CostDBCSV</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span>
            <span class="bp">self</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">module_dir</span><span class="p">,</span> <span class="s2">&quot;costdb_elements.csv&quot;</span><span class="p">))</span>


<div class="viewcode-block" id="CostAnalyzer"><a class="viewcode-back" href="../../../pymatgen.analysis.cost.html#pymatgen.analysis.cost.CostAnalyzer">[docs]</a><span class="k">class</span> <span class="nc">CostAnalyzer</span><span class="p">:</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Given a CostDB, figures out the minimum cost solutions via convex hull</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">costdb</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Args:</span>
<span class="sd">            costdb (): Cost database.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">costdb</span> <span class="o">=</span> <span class="n">costdb</span>

<div class="viewcode-block" id="CostAnalyzer.get_lowest_decomposition"><a class="viewcode-back" href="../../../pymatgen.analysis.cost.html#pymatgen.analysis.cost.CostAnalyzer.get_lowest_decomposition">[docs]</a>    <span class="k">def</span> <span class="nf">get_lowest_decomposition</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">composition</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Get the decomposition leading to lowest cost</span>

<span class="sd">        Args:</span>
<span class="sd">            composition:</span>
<span class="sd">                Composition as a pymatgen.core.structure.Composition</span>
<span class="sd">        Returns:</span>
<span class="sd">            Decomposition as a dict of {Entry: amount}</span>
<span class="sd">        &quot;&quot;&quot;</span>

        <span class="n">entries_list</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="n">elements</span> <span class="o">=</span> <span class="p">[</span><span class="n">e</span><span class="o">.</span><span class="n">symbol</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">composition</span><span class="o">.</span><span class="n">elements</span><span class="p">]</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">elements</span><span class="p">)):</span>
            <span class="k">for</span> <span class="n">combi</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">combinations</span><span class="p">(</span><span class="n">elements</span><span class="p">,</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">):</span>
                <span class="n">chemsys</span> <span class="o">=</span> <span class="p">[</span><span class="n">Element</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">combi</span><span class="p">]</span>
                <span class="n">x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">costdb</span><span class="o">.</span><span class="n">get_entries</span><span class="p">(</span><span class="n">chemsys</span><span class="p">)</span>
                <span class="n">entries_list</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">pd</span> <span class="o">=</span> <span class="n">PhaseDiagram</span><span class="p">(</span><span class="n">entries_list</span><span class="p">)</span>
            <span class="k">return</span> <span class="n">pd</span><span class="o">.</span><span class="n">get_decomposition</span><span class="p">(</span><span class="n">composition</span><span class="p">)</span>
        <span class="k">except</span> <span class="ne">IndexError</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Error during PD building; most likely, &quot;</span>
                             <span class="s2">&quot;cost data does not exist!&quot;</span><span class="p">)</span></div>

<div class="viewcode-block" id="CostAnalyzer.get_cost_per_mol"><a class="viewcode-back" href="../../../pymatgen.analysis.cost.html#pymatgen.analysis.cost.CostAnalyzer.get_cost_per_mol">[docs]</a>    <span class="k">def</span> <span class="nf">get_cost_per_mol</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">comp</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Get best estimate of minimum cost/mol based on known data</span>

<span class="sd">        Args:</span>
<span class="sd">            comp:</span>
<span class="sd">                Composition as a pymatgen.core.structure.Composition</span>
<span class="sd">        Returns:</span>
<span class="sd">            float of cost/mol</span>
<span class="sd">        &quot;&quot;&quot;</span>

        <span class="n">comp</span> <span class="o">=</span> <span class="n">comp</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">comp</span><span class="p">,</span> <span class="n">Composition</span><span class="p">)</span> <span class="k">else</span> <span class="n">Composition</span><span class="p">(</span><span class="n">comp</span><span class="p">)</span>
        <span class="n">decomp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_lowest_decomposition</span><span class="p">(</span><span class="n">comp</span><span class="p">)</span>
        <span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">k</span><span class="o">.</span><span class="n">energy_per_atom</span> <span class="o">*</span> <span class="n">v</span> <span class="o">*</span> <span class="n">comp</span><span class="o">.</span><span class="n">num_atoms</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span>
                   <span class="n">decomp</span><span class="o">.</span><span class="n">items</span><span class="p">())</span></div>

<div class="viewcode-block" id="CostAnalyzer.get_cost_per_kg"><a class="viewcode-back" href="../../../pymatgen.analysis.cost.html#pymatgen.analysis.cost.CostAnalyzer.get_cost_per_kg">[docs]</a>    <span class="k">def</span> <span class="nf">get_cost_per_kg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">comp</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Get best estimate of minimum cost/kg based on known data</span>

<span class="sd">        Args:</span>
<span class="sd">            comp:</span>
<span class="sd">                Composition as a pymatgen.core.structure.Composition</span>
<span class="sd">        Returns:</span>
<span class="sd">            float of cost/kg</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">comp</span> <span class="o">=</span> <span class="n">comp</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">comp</span><span class="p">,</span> <span class="n">Composition</span><span class="p">)</span> <span class="k">else</span> <span class="n">Composition</span><span class="p">(</span><span class="n">comp</span><span class="p">)</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_cost_per_mol</span><span class="p">(</span><span class="n">comp</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span>
                <span class="n">comp</span><span class="o">.</span><span class="n">weight</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="s2">&quot;kg&quot;</span><span class="p">)</span> <span class="o">*</span> <span class="n">const</span><span class="o">.</span><span class="n">N_A</span><span class="p">)</span></div></div>
</pre></div>

            <div class="clearer"></div>
          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../index.html">pymatgen 2020.7.3 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../../pymatgen.html" >pymatgen</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">pymatgen.analysis.cost</a></li> 
      </ul>
    </div>

    <div class="footer" role="contentinfo">
        &#169; Copyright 2011, Pymatgen Development Team.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.1.2.
    </div>
<div class="footer">This page uses <a href="http://analytics.google.com/">
Google Analytics</a> to collect statistics. You can disable it by blocking
the JavaScript coming from www.google-analytics.com.
<script type="text/javascript">
  (function() {
    var ga = document.createElement('script');
    ga.src = ('https:' == document.location.protocol ?
              'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    ga.setAttribute('async', 'true');
    document.documentElement.firstChild.appendChild(ga);
  })();
</script>
</div>

  </body>
</html>